package com.wsx.rpc.dubbo.plug;

import com.alibaba.dubbo.common.utils.StringUtils;

/**
 * @author wangshuaixin
 * @Title: com.wsx.rpc.dubbo.plug.SwitchService
 * @Description: TODO
 * @date 2018/10/31
 */
public final class SwitchService {

    private static final ThreadLocal<String> SWITCH = new ThreadLocal<>();

    public static String getSwitch() {
        if (!StringUtils.isEmpty(SWITCH.get())) {
            return SWITCH.get();
        }
        return null;
    }

    public static void setSwitch(String sw) {
        SWITCH.set(sw);
    }

    public static void complate() {
        SWITCH.remove();
    }
}
